package client;

import java.awt.BorderLayout;
//import java.server;
import java.awt.EventQueue;
import java.net.MalformedURLException;
import java.rmi.*;

import javax.swing.ImageIcon;
import javax.swing.JDialog;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import javax.swing.JLabel;
import javax.swing.JButton;

import java.awt.Dialog.ModalityType;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;

public class EntertainmentCity extends JDialog {

	private JPanel contentPane;

	/**
	 * Launch the application.
	 */
	public static void main(String[] args) {
		EventQueue.invokeLater(new Runnable() {
			public void run() {
				try {
					EntertainmentCity frame = new EntertainmentCity("欢迎光临娱乐城！");
					frame.setVisible(true);
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		});
	}

	/**
	 * Create the frame.
	 */
	public EntertainmentCity(String title) {
		super();;
		this.setTitle(title);
		setBounds(100, 100, 450, 300);
		setModalityType(ModalityType.APPLICATION_MODAL);
		contentPane = new JPanel();
		contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
		setContentPane(contentPane);
		contentPane.setLayout(null);
		
		JButton btnKtv = new JButton("KTV");
		btnKtv.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				KTV dialog;
				
				try {
					dialog = new KTV(null,"KTV",true);
					dialog.setLocationRelativeTo(null);
					dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
					dialog.setVisible(true);
				} catch (MalformedURLException e1) {
					// TODO Auto-generated catch block
					e1.printStackTrace();
				} catch (RemoteException e1) {
					// TODO Auto-generated catch block
					e1.printStackTrace();
				} catch (NotBoundException e1) {
					// TODO Auto-generated catch block
					e1.printStackTrace();
				}
				
			}
		});
		btnKtv.setBounds(99, 64, 93, 23);
		contentPane.add(btnKtv);
		
		JButton btnNetBar = new JButton("网吧");
		btnNetBar.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				//NetBar.main(null);
				try {
					NetBar dlg=new NetBar(null,"网吧",true);
					dlg.setLocationRelativeTo(null);
					dlg.setVisible(true);
				} catch (MalformedURLException e1) {
					// TODO Auto-generated catch block
					e1.printStackTrace();
				} catch (RemoteException e1) {
					// TODO Auto-generated catch block
					e1.printStackTrace();
				} catch (NotBoundException e1) {
					// TODO Auto-generated catch block
					e1.printStackTrace();
				}
			}
		});
		btnNetBar.setBounds(246, 64, 93, 23);
		contentPane.add(btnNetBar);
		
		JButton btnNewButton = new JButton("酒吧");
		btnNewButton.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				try {
					Pub dlg=new Pub(null,"酒吧",true);
					dlg.setLocationRelativeTo(null);
					dlg.setVisible(true);
				} catch (MalformedURLException e1) {
					// TODO Auto-generated catch block
					e1.printStackTrace();
				} catch (RemoteException e1) {
					// TODO Auto-generated catch block
					e1.printStackTrace();
				} catch (NotBoundException e1) {
					// TODO Auto-generated catch block
					e1.printStackTrace();
				}
			}
		});
		btnNewButton.setBounds(99, 153, 93, 23);
		contentPane.add(btnNewButton);
		
		JButton btnNewButton_1 = new JButton("桌球");
		btnNewButton_1.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				try {
					Billiards dlg=new Billiards(null,"网吧",true);
					dlg.setLocationRelativeTo(null);
					dlg.setVisible(true);
				} catch (MalformedURLException e1) {
					// TODO Auto-generated catch block
					e1.printStackTrace();
				} catch (RemoteException e1) {
					// TODO Auto-generated catch block
					e1.printStackTrace();
				} catch (NotBoundException e1) {
					// TODO Auto-generated catch block
					e1.printStackTrace();
				}
			}
		});
		btnNewButton_1.setBounds(246, 153, 93, 23);
		contentPane.add(btnNewButton_1);
		
		JButton btnExit = new JButton("离开");
		btnExit.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) {
				dispose();
			}
		});
		btnExit.setBounds(319, 217, 93, 23);
		contentPane.add(btnExit);
		
		JLabel lblNewLabel = new JLabel(new ImageIcon("src/client/images/娱乐城.jpg"));
		lblNewLabel.setBounds(0, 0, 434, 268);
		contentPane.add(lblNewLabel);

	}
	
}
